﻿package mortal.game.view.ranking.view
{
    import Message.Public.*;
    import com.greensock.layout.*;
    import com.mui.controls.*;
    import com.mui.display.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.game.manager.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.display.*;

    public class RankingFirstInfoCell extends GSprite
    {
        private var _bg:GImageBitmap;
        private var _titleImg:GImageBitmap;
        private var _titleTxt:GTextFiled;
        private var _name:GTextFiled;
        private var _combatOrLevel:GImageBitmap;
        private var _levelOrCombat:BitmapNumberText;
        private var _selBorder:ScaleBitmap;
        private var _rankingData:SToplist;

        public function RankingFirstInfoCell()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._bg = UIFactory.gImageBitmap(ImagesConst.RankingFirstBg, 0, 0, this);
            this._titleImg = UIFactory.gImageBitmap("", 70, 27, this);
            this._titleTxt = UIFactory.gTextField("", 82 - 3, 63 - 2, 72, 20, this, GlobalStyle.textFormatDanLan);
            var _loc_1:* = GlobalStyle.textFormatHuang2;
            _loc_1.size = 14;
            _loc_1.align = AlignMode.CENTER;
            this._name = UIFactory.gTextField("", 39, 87 - 4, 138, 30, this, _loc_1);
            this._combatOrLevel = UIFactory.gImageBitmap("", 47, 112, this);
            this._levelOrCombat = UIFactory.bitmapNumberText(96, 112, "FightInfoNum.png", 12, 15, -1, this);
            this._selBorder = UIFactory.bg(-2, -2, 218 + 4, 133 + 4, this, ImagesConst.selectFilter);
            this._selBorder.visible = false;
            this.mouseChildren = false;
            this.mouseEnabled = true;
            this.configEventListener(MouseEvent.MOUSE_OVER, this.onOverHandler);
            this.configEventListener(MouseEvent.MOUSE_OUT, this.onOutHandler);
            return;
        }// end function

        public function set bg(param1:int) : void
        {
            switch(param1)
            {
                case 1:
                {
                    this._titleImg.imgUrl = ImagesConst.RankingTextZhanshen;
                    break;
                }
                case 2:
                {
                    this._titleImg.imgUrl = ImagesConst.RankingTextChongji;
                    break;
                }
                case 3:
                {
                    this._titleImg.imgUrl = ImagesConst.RankingTextShenchong;
                    break;
                }
                case 4:
                {
                    this._titleImg.imgUrl = ImagesConst.RankingTextTieji;
                    break;
                }
                case 5:
                {
                    this._titleImg.imgUrl = ImagesConst.RankingTextRuhu;
                    break;
                }
                case 6:
                {
                    this._titleImg.imgUrl = ImagesConst.RankingTextShenqi;
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

        public function set data(param1:Object) : void
        {
            var _loc_2:SToplist = null;
            var _loc_3:int = 0;
            var _loc_4:int = 0;
            var _loc_5:String = null;
            this.clear();
            if (param1)
            {
                _loc_2 = param1 as SToplist;
                this._rankingData = _loc_2;
                if (_loc_2.reverse1 == EToplistType._EToplistTypePlayerLevel)
                {
                    this._titleTxt.text = Language.getString(41359);
                    this._name.text = this._rankingData.entityName;
                    this._combatOrLevel.visible = true;
                    this._levelOrCombat.visible = true;
                    this._combatOrLevel.imgUrl = ImagesConst.RankingTextLevel;
                    this._combatOrLevel.x = 47 + 26;
                    this._levelOrCombat.text = _loc_2.valueOne.toString();
                    this._levelOrCombat.x = 96 + 26;
                }
                if (_loc_2.reverse1 == EToplistType._EToplistTypePlayerCombat)
                {
                    this._titleTxt.text = Language.getString(41360);
                    this._name.text = this._rankingData.entityName;
                    this._combatOrLevel.visible = true;
                    this._levelOrCombat.visible = true;
                    this._combatOrLevel.imgUrl = ImagesConst.RankingTextCombat;
                    this._levelOrCombat.text = _loc_2.valueOne.toString();
                }
                if (_loc_2.reverse1 == EToplistType._EToplistTypePetGrowth)
                {
                    this._titleTxt.text = Language.getString(41361);
                    this._name.text = this._rankingData.ownerName;
                    this._combatOrLevel.visible = true;
                    this._levelOrCombat.visible = true;
                    this._combatOrLevel.imgUrl = ImagesConst.RankingText_Level;
                    this._combatOrLevel.x = 47 + 26;
                    this._levelOrCombat.text = _loc_2.valueOne.toString();
                    this._levelOrCombat.x = 96 + 26;
                }
                if (_loc_2.reverse1 == EToplistType._EToplistTypeMountRank)
                {
                    this._titleTxt.text = Language.getString(41362);
                    this._name.text = this._rankingData.ownerName;
                    this._combatOrLevel.visible = true;
                    this._levelOrCombat.visible = true;
                    this._combatOrLevel.imgUrl = ImagesConst.RankingText_Level;
                    this._combatOrLevel.x = 47 + 26;
                    this._levelOrCombat.text = _loc_2.valueOne.toString();
                    this._levelOrCombat.x = 96 + 26;
                }
                if (_loc_2.reverse1 == EToplistType._EToplistTypeWeapon || _loc_2.reverse1 == EToplistType._EToplistTypeEquipArmor || _loc_2.reverse1 == EToplistType._EToplistTypeEquipJewelry)
                {
                    this._titleTxt.text = Language.getString(41363);
                    this._name.text = this._rankingData.ownerName;
                    this._combatOrLevel.visible = true;
                    this._levelOrCombat.visible = true;
                    this._combatOrLevel.imgUrl = ImagesConst.RankingText_Level;
                    this._combatOrLevel.x = 47 + 26;
                    this._levelOrCombat.text = _loc_2.valueOne.toString();
                    this._levelOrCombat.x = 96 + 26;
                }
                if (_loc_2.reverse1 == EToplistType._EToplistTypeGuildCombat)
                {
                }
                if (_loc_2.reverse1 == EToplistType._EToplistTypeWing)
                {
                    this._titleTxt.text = Language.getString(41364);
                    this._name.text = this._rankingData.ownerName;
                    this._combatOrLevel.visible = true;
                    this._levelOrCombat.visible = true;
                    this._combatOrLevel.imgUrl = ImagesConst.RankingText_Level;
                    this._combatOrLevel.x = 47 + 26;
                    this._levelOrCombat.text = _loc_2.valueOne.toString();
                    this._levelOrCombat.x = 96 + 26;
                }
                if (_loc_2.reverse1 == EToplistType._EToplistTypePlayerLevel || _loc_2.reverse1 == EToplistType._EToplistTypePlayerCombat)
                {
                }
                _loc_3 = _loc_2.propertyThree;
                _loc_4 = _loc_2.propertyTwo;
                _loc_5 = "AvatarRanking_" + _loc_3 + "_" + _loc_4;
            }
            return;
        }// end function

        public function set isSelected(param1:Boolean) : void
        {
            if (param1)
            {
                EffectManager.glowFilterReg(this._bg, null, 0);
            }
            else
            {
                EffectManager.glowFilterUnReg(this._bg);
            }
            return;
        }// end function

        private function clear() : void
        {
            this._name.text = Language.getString(41365);
            this._combatOrLevel.visible = false;
            this._levelOrCombat.visible = false;
            return;
        }// end function

        public function get rankingData() : SToplist
        {
            return this._rankingData;
        }// end function

        private function onOverHandler(event:MouseEvent) : void
        {
            CursorManager.showCursor(CursorManager.BUTTON);
            return;
        }// end function

        private function onOutHandler(event:MouseEvent) : void
        {
            CursorManager.hideFromButton();
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._bg.dispose(param1);
            this._levelOrCombat.dispose(param1);
            this._titleImg.dispose(param1);
            this._selBorder.dispose(param1);
            this._titleTxt.dispose();
            this._combatOrLevel.dispose();
            this._name.dispose();
            this._bg = null;
            this._levelOrCombat = null;
            this._titleImg = null;
            this._selBorder = null;
            this._rankingData = null;
            this._titleTxt = null;
            this._combatOrLevel = null;
            this._name = null;
            return;
        }// end function

    }
}
